package com.dongdongshop.controller;

import com.dongdongshop.data.Page;
import com.dongdongshop.data.Result;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.pojo.TbSeller;
import com.dongdongshop.service.SellerService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("seller")
public class SellerController {
    @DubboReference
    private SellerService sellerService;

    @RequestMapping("findList")
    @ResponseBody
    public Result findList(@RequestParam(defaultValue = "1")Integer pageNum,
                           @RequestParam(defaultValue = "3")Integer pageSize,
                           TbSeller tbSeller){
        Page<TbSeller> page = sellerService.findList(pageNum,pageSize,tbSeller);
        return Result.ok().setData(page);
    }

    @RequestMapping("selectBySellerId")
    @ResponseBody
    public Result selectBySellerId(String sellerId){
        TbSeller tbSeller = sellerService.selectBySellerId(sellerId);
        return Result.ok().setData(tbSeller);
    }

    @RequestMapping("updateInfo")
    @ResponseBody
    public Result updateInfo(TbSeller tbSeller){
        sellerService.updateInfo(tbSeller);
        return Result.ok();
    }
}
